home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Full / Serif Page Plus 8 PDF / data1.cab / Help / helpfile.chm / w002_script.js < prev   
Encoding:
JavaScript  |  2007-10-26  |  8.1 KB  |  265 lines

  1. // MODULE:    
  2. // DESCRIPTION: functions 
  3. // FACILITY:    Serif PagePlus 7
  4. // DATE:    20 October 1999
  5.  
  6.  
  7. var decimalPointDelimiter = ".";
  8. var abspath;
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17. // ---------------------------------------------------------------------------
  18. // FUNCTION:    mOut()
  19. // DESCRIPTION: Changes the apperance of a text object to it's original
  20. //        settings.
  21.  
  22. function mOut() {
  23.     window.event.srcElement.style.color = "black"
  24.     window.event.srcElement.style.textDecoration = "none"
  25. }
  26.  
  27. // ---------------------------------------------------------------------------
  28. // FUNCTION:    mOver()
  29. // DESCRIPTION: Changes the apperance of a text object to a "highlighted"
  30. //        settings.
  31.  
  32. function mOver() {
  33.     window.event.srcElement.style.color = "orange"
  34.     window.event.srcElement.style.textDecoration = "underline"
  35.     window.event.srcElement.style.cursor = "hand"
  36. }
  37.  
  38. // ---------------------------------------------------------------------------
  39. // Returns true if string is empty or whitespace characters only.
  40. function isWhitespace (str)
  41. {   var i;
  42.  
  43.     if (isEmpty(str)) return true;
  44.  
  45.     for (i = 0; i < str.length; i++) {   
  46.         // Check that current character isn't whitespace.
  47.         var c = str.charAt(i);
  48.         if (whitespace.indexOf(c) == -1) return false;
  49.     }
  50.  
  51.     // All characters are whitespace.
  52.     return true;
  53. }
  54.  
  55.  
  56. // ---------------------------------------------------------------------------
  57. // Returns true if character c is a digit (0 -> 9)
  58. function isDigit (c) {   
  59.     return ((c >= "0") && (c <= "9"))
  60. }
  61.  
  62.  
  63.  
  64. // ---------------------------------------------------------------------------
  65. // isFloat (STRING s [, BOOLEAN emptyOK])
  66. // 
  67. // True if string s is an unsigned floating point (real) number. 
  68. //
  69. // Also returns true for unsigned integers. If you wish
  70. // to distinguish between integers and floating point numbers,
  71. // first call isInteger, then call isFloat.
  72.  
  73. function isFloat (s)
  74. {   var i;
  75.     var seenDecimalPoint = false;
  76.  
  77.     //if (isEmpty(s)) 
  78.     //   if (isFloat.arguments.length == 1) return defaultEmptyOK;
  79.     //   else return (isFloat.arguments[1] == true);
  80.  
  81.     if (s == decimalPointDelimiter) return false;
  82.  
  83.     // Search through string's characters one by one
  84.     // until we find a non-numeric character.
  85.     // When we do, return false; if we don't, return true.
  86.  
  87.     for (i = 0; i < s.length; i++)
  88.     {   
  89.         // Check that current character is number.
  90.         var c = s.charAt(i);
  91.  
  92.         if ((c == decimalPointDelimiter) && !seenDecimalPoint) seenDecimalPoint = true;
  93.         else if (!isDigit(c)) return false;
  94.     }
  95.  
  96.     // All characters are numbers.
  97.     return true;
  98. }
  99.  
  100.  
  101. // ---------------------------------------------------------------------------
  102. // FUNCTION:    Get_TimeDate()
  103. // DESCRIPTION: Gets the current time and date and formats the result into
  104. //        a string based on HH:MM  DD/MM/YEAR
  105.  
  106. function Get_TimeDate() {
  107.     var DateObj   = new Date(); 
  108.     var Day, Month, Year, Minutes, Hours;
  109.  
  110.     Day   = DateObj.getDate();
  111.     Month = DateObj.getMonth();
  112.     Year  = DateObj.getYear();    
  113.  
  114.     Minutes = DateObj.getMinutes();
  115.     Hours   = DateObj.getHours();
  116.  
  117.     if (Minutes < 10) {
  118.     Minutes = "0"+Minutes;
  119.     }
  120.  
  121.     DateString = Hours +":"+ Minutes +"  "+ Day +"/"+ Month +"/"+ Year;        
  122.  
  123.     return DateString;
  124. }
  125.  
  126. // -------------------------------------------------------------------------------------------------------
  127. // FUNCTION:    get_absolute_path()
  128. // DESCRIPTION: Retrieves an absolute path to the folder where the current file is located.
  129. // AUTHOR:    Rob Nicholls
  130. // CHANGES:    Global variable: abspath
  131. // -------------------------------------------------------------------------------------------------------
  132. function get_absolute_path() {
  133.     var temp, strEnd, strStart;
  134.  
  135.     temp        = this.location.pathname;
  136.     strEnd        = temp.length;
  137.     strStart    = temp.lastIndexOf("\\");
  138.     abspath        = temp.substring(1,((temp.length)-(strEnd-strStart)));
  139.     return;
  140. }
  141.  
  142. // -------------------------------------------------------------------------------------------------------
  143. // FUNCTION:    change_current_chm()
  144. // DESCRIPTION: Change the current URL in the browser window to the specified file, based on the value
  145. //              of "abspath". i.e. result will be "abspath"\"Page".
  146. // CHANGES:    this.location
  147. // AUTHOR:    Rob Nicholls
  148. // -------------------------------------------------------------------------------------------------------
  149. function change_current_chm( Page ) {
  150.     var temp;
  151.  
  152.     temp        = abspath +"\\"+ Page;
  153.     this.location    = temp;
  154.     return;
  155. }
  156.  
  157.  
  158. // -------------------------------------------------------------------------------------------------------
  159. // FUNCTION:    CHMStringReference( grafix )
  160. // DESCRIPTION: Returns a concatanated string to a .chm and grafix in the common folder
  161. // CHANGES:    none
  162. // RETURN VAL:    formatted absolute path and filename.
  163. // AUTHOR:    Rob Nicholls
  164. // -------------------------------------------------------------------------------------------------------
  165. function CHMStringReference( grafix ) {
  166.     //var CommonCHM = "C:/Program Files/Serif/pageplus/7.0/help/common";
  167.     var CommonCHM = theApplication.CHMDirectory;
  168.  
  169.     return "mk:@MSITStore:" + CommonCHM + "grafix.chm::" + grafix;
  170. }
  171.  
  172. // -------------------------------------------------------------------------------------------------------
  173. // FUNCTION:    CHMStringReference( grafix )
  174. // DESCRIPTION: Returns a concatanated string to a .chm and grafix in the common folder
  175. // CHANGES:    none
  176. // RETURN VAL:    formatted absolute path and filename.
  177. // AUTHOR:    Rob Nicholls
  178. // -------------------------------------------------------------------------------------------------------
  179. function CHMPageReference( page ) {
  180.     //var CommonCHM = "C:/Program Files/Serif/pageplus/7.0/help/common";
  181.     var CommonCHM = theApplication.CHMDirectory;
  182.  
  183.     return "mk:@MSITStore:" +CommonCHM +"common.chm::/" +page;
  184. }
  185.  
  186.  
  187. // -------------------------------------------------------------------------------------------------------
  188. // FUNCTION:    HideToolbarsAndTabs( void )
  189. // DESCRIPTION: Hides all the toolbars and tabs, except the wizard tab, within the current window
  190. // CHANGES:    Toolbars.visiable state (boolean)
  191. // RETURN VAL:    none.
  192. // AUTHOR:    Rob Nicholls
  193. // -------------------------------------------------------------------------------------------------------
  194. function HideToolbarsAndTabs() {
  195.     var WToolbars,WToolbars2;
  196.     var ToolbarCount, c;
  197.  
  198.     // Hide the standard tabs
  199.     theWindow.RulersVisible     = 0;
  200.     theWindow.StatusBarVisible    = 0;
  201.     theWindow.MenuVisible         = 0;
  202.  
  203.     // see how many toolbars are in the window
  204.     WToolbars    = theWindow.Toolbars;
  205.     ToolbarCount    = WToolbars.Count();
  206.  
  207.     // Then hide them all
  208.     for(c=0; c<(ToolbarCount+1); c++) {        
  209.         WToolbars.Item(c).visible = 0;
  210.     }
  211.  
  212.     // Hide all other elements of the studio bar
  213.     //WToolbars2    = theWindow.StudioBar;
  214.  
  215.     //WToolbars2.ColoursVisible    = 0;
  216.     //WToolbars2.FillsVisible        = 0;
  217.     //WToolbars2.TransparenciesVisible= 0;
  218.     //WToolbars2.FontsVisible        = 0;
  219.     //WToolbars2.SchemesVisible    = 0;
  220.  
  221.     
  222.     return;
  223. }
  224.  
  225. // -------------------------------------------------------------------------------------------------------
  226. // FUNCTION:    ShowToolbarsAndTabs( void )
  227. // DESCRIPTION: Shows all the toolbars and tabs, except the wizard tab, within the current window
  228. // CHANGES:    Toolbars.visiable state (boolean)
  229. // RETURN VAL:    none.
  230. // AUTHOR:    Rob Nicholls
  231. // -------------------------------------------------------------------------------------------------------
  232. function ShowToolbarsAndTabs() {
  233.     var WToolbars;
  234.     var ToolbarCount, c;
  235.  
  236.     // Show the standard tabs
  237.     theWindow.RulersVisible     = 1;
  238.     theWindow.StatusBarVisible    = 1;
  239.     theWindow.MenuVisible         = 1;
  240.  
  241.     // see how many toolbars are in the window
  242.     WToolbars    = theWindow.Toolbars;
  243.     ToolbarCount    = WToolbars.Count();
  244.  
  245.     // Then show them all
  246.     for(c=0; c<(ToolbarCount+1); c++) {        
  247.         WToolbars.Item(c).visible = 1;
  248.     }
  249.  
  250.     // Show all other elements of the studio bar
  251.     //WToolbars    = theWindow.StudioBar;
  252.  
  253.     //WToolbars.ColoursVisible    = 1;
  254.     //WToolbars.FillsVisible        = 1;
  255.     //WToolbars.TransparenciesVisible    = 1;
  256.     //WToolbars.FontsVisible        = 1;
  257.     //WToolbars.SchemesVisible    = 1;
  258.  
  259.  
  260.     return;
  261. }
  262.  
  263.  
  264.  
  265.